package order

import (
	"api/pb/order"
	"context"

	"api/internal/svc"
	"api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type UpdateOrderLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewUpdateOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateOrderLogic {
	return &UpdateOrderLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *UpdateOrderLogic) UpdateOrder(req *types.Order) (*types.Empty, error) {
	// TODO 订单没有数据更新, 只能更新状态, 这里是fake
	_, err := l.svcCtx.OrderRpc.UpdateOrder(l.ctx, &order.OrderInfo{OrderId: req.OrderId})
	return &types.Empty{}, err
}
